package company.tx;

import java.util.*;

public class Tx2 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int k = Integer.parseInt(sc.nextLine());
        TreeSet<String> set = new TreeSet<>();
        int length = s.length();
        for (int i = 0; i < length; i++) {
            for (int j = i + 1; j <= length; j++) {
                String substring = s.substring(i, j);
                if (set.contains(substring))
                    continue;
                if (set.size() == k) {
                    String level = set.last();
                    if (substring.compareTo(level) < 0) {
                        set.remove(level);
                        set.add(substring);
                    }
                } else {
                    set.add(substring);
                }
            }
        }
        System.out.println(set.last());
    }
}
